import $service from '../../../../../service.js';
var that;
const app = getApp();
Page({
  data: {
    phone_search: '',
    user_id: '',
    user_type: '',
    patientList: []
  },

  onLoad: function (options) {
    this.setData({
      phone_search: options.phone
    })
  },
  onShow() {
    that = this.data;
    this.getInterrogationHistoryInfo();
  },
  getInterrogationHistoryInfo() {
    app.http.getInterrogationHistoryInfo({mobile: that.phone_search}, true).then(res => {
      console.log(res.data.list)
      this.setData({
        patientList: res.data.list
      })
    }).catch(err => {
      $service.showToast(err.msg);
    })
  },



  inputChange(e) {
    let name = e.detail.value;
    this.setData({
      phone_search: name
    })
  },
  useHistory(e) {
    console.log(e)
    let idx = e.currentTarget.dataset.index;
    let changeData = that.patientList[idx]
    $service.setStore('inquiryHistory', JSON.stringify(changeData));
    wx.navigateBack();
  }
})